﻿using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Drawing;
using GeoWeb.Common;

namespace GeoWeb.Demo.Commons
{
    public partial class GeoImageHelper_Demo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            funGeoImageHelper();
        }

        #region GeoImageHelper
        private void funGeoImageHelper()
        {
            //打开图像文件并读取到数组中
            ImageHelper ihelper = new ImageHelper();
            byte[] imageArr = ihelper.ImageToBytes(@"D:\Tencent.PNG");

            //返回图像的高宽
            Int32[] dime = ihelper.GetDimensions(imageArr);

            //将图像格式的二进制数组转换为 image对象
            System.Drawing.Image iimage = ihelper.ConvertToImage(imageArr);

            //将image对象转换为图像格式的二进制数组
            byte[] bytimage = ihelper.ConvertToBytes(iimage);

            //将图像格式的二进制数组转换为缩略图二进制数组
            byte[] bytthumb = ihelper.ConvertToThumbNail(imageArr, 100, 100);

            //将图像格式的二进制数组转换为缩略图二进制数组 并保存
            bool success = ihelper.ConvertToThumbNail(imageArr, 100, 100, @"d:\thumb.png", System.Drawing.Imaging.ImageFormat.Png);


        }
        #endregion
    }
}